home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / PIBSIGS / TESTINVN.PAS < prev    next >
Pascal/Delphi Source File  |  1986-06-22  |  2KB  |  55 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*                 TestInvN --- Test inverse normal                         *)
  3. (*--------------------------------------------------------------------------*)
  4.  
  5. PROGRAM TestInvN;
  6.  
  7. (*--------------------------------------------------------------------------*)
  8. (*                                                                          *)
  9. (*   Program:  TestInvN                                                     *)
  10. (*                                                                          *)
  11. (*   Purpose:  Demonstrate inverse normal routine in PIBSIGS                *)
  12. (*                                                                          *)
  13. (*   Usage:    This program prompts for a tail probability value.           *) )
  14. (*             It computes and prints the corresponding percentage point    *)
  15. (*             of the normal distribution.                                  *)
  16. (*                                                                          *)
  17. (*             To stop the program, enter a negative p-value.               *)
  18. (*                                                                          *)
  19. (*   Calls:    Ninv2                                                        *)
  20. (*                                                                          *)
  21. (*--------------------------------------------------------------------------*)
  22.  
  23. VAR
  24.    Z:    REAL;
  25.    P:    REAL;
  26.    Done: BOOLEAN;
  27.  
  28. (*$I SIGCONST.PAS *)
  29. (*$I ERF.PAS      *)
  30. (*$I SIGNORM.PAS  *)
  31. (*$I NINV.PAS     *)
  32. (*$I NINV2.PAS    *)
  33.  
  34. BEGIN (* TestInvN *)
  35.  
  36.    Done := FALSE;
  37.    ClrScr;
  38.  
  39.    REPEAT
  40.  
  41.       WRITE('Enter tail probability: ');
  42.       READLN( P );
  43.  
  44.       IF ( P > 0.0 ) THEN
  45.          BEGIN
  46.             Z     := Ninv2( P );
  47.             WRITELN('Normal distribution percentage point = ',Z:12:5);
  48.          END
  49.       ELSE
  50.          Done := TRUE;
  51.  
  52.    UNTIL Done;
  53.  
  54.  
  55. END   (* TestInvN *).